﻿using System;
using System.Collections.Generic;
using System.Xml;
using CSLauncher.Configuration.Interface;

namespace CSLauncher.Configuration.Xml
{
    internal class SubMenu : Item, ISubmenu
    {
        private readonly List<IItem> items;

        public SubMenu(XmlNode node, SubMenu parent)
            : base(node)
        {
            items = new List<IItem>();
            items.Add(null);
            foreach (XmlNode subNode in Node.ChildNodes)
            {
                items.Add(Create(subNode, this));
            }

            Parent = parent;
        }

        public IList<IItem> Items
        {
            get { return items.AsReadOnly(); }
        }

        public ISubmenu Parent { get; private set; }
    }
}
